package com.zretc.kscxmz.services.impl;

import com.zretc.kscxmz.entity.Menu;
import com.zretc.kscxmz.mappers.MenuMapper;
import com.zretc.kscxmz.services.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuMapper menuMapper;

    /**
     * 一级菜单
     * @return
     */
    @Override
    public List<Menu> getRootMenu() {
        return menuMapper.findRootMenu();
    }

    @Override
    public List<Menu> getSubMenuByParentId(Integer parentId,Integer roleId) {
        return menuMapper.findSubMenuByParentId(parentId,roleId);
    }

    @Override
    public List<Menu> getAllMenu() {
        return menuMapper.findAllMenu();
    }

    @Override
    public List<Menu> getMenuByRoleId(Integer roleId) {
        return menuMapper.findMenuByRoleId(roleId);
    }

    @Override
    public int modifyShowStatusByMenuId(List<String> list, Integer roleId, Integer showStatus) {
        return menuMapper.updateShowStatusByMenuId(list,roleId,showStatus);
    }
}
